/**
 *
 */
import OpenApi;
import OpenApi.OpenApiUtil;

extends OpenApi;


init(config: OpenApiUtil.Config){
  super(config);
  @endpointRule = 'regional';
  
  checkConfig(config);
  @endpoint = getEndpoint('brain-industrial', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!$isNull(endpoint)) {
    return endpoint;
  }
  
  if (!$isNull(endpointMap) && !$isNull(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return OpenApiUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model ActivateLicenseRequest {
  fingerprint?: string(name='Fingerprint', example='XXX'),
  id?: string(name='Id', description='ID'),
  instanceId?: string(name='InstanceId', example='12bea6b4489fsde7b903fe05934a0adx'),
  orderId?: string(name='OrderId'),
}

model ActivateLicenseResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', example='{}'),
  code?: string(name='Code', example='200'),
  data?: {
    activateRecord?: [ 
      {
        activateTime?: string(name='ActivateTime', example='2024-04-29 15:03:12'),
        buyTime?: string(name='BuyTime', example='2024-04-29 15:01:15'),
        duration?: string(name='Duration'),
        expireTime?: string(name='ExpireTime', example='2025-05-01 00:00:00'),
        licenseCode?: string(name='LicenseCode', example='XXX'),
        orderId?: string(name='OrderId', example='XXX'),
        status?: string(name='Status', example='activated'),
      }
    ](name='ActivateRecord'),
    activateTime?: string(name='ActivateTime', example='2024-04-29 15:03:12'),
    allDuration?: string(name='AllDuration'),
    applicableSpecs?: string(name='ApplicableSpecs'),
    buyTime?: string(name='BuyTime', example='2024-04-29 15:00:15'),
    cpuLimit?: int32(name='CpuLimit', example='72'),
    description?: string(name='Description', example='""'),
    duration?: string(name='Duration'),
    effectTime?: string(name='EffectTime', example='2024-05-01 00:00:00'),
    expireTime?: string(name='ExpireTime', example='2025-05-01 00:00:00'),
    fingerprint?: string(name='Fingerprint', example='XXXX'),
    id?: string(name='Id', description='Id', example='1'),
    instanceId?: string(name='InstanceId', example='c39128fcb74e482546a72de90cdsaba3'),
    licenseCode?: string(name='LicenseCode', example='XXX'),
    licenseSpecName?: string(name='LicenseSpecName'),
    memoryLimit?: int32(name='MemoryLimit', example='256'),
    status?: string(name='Status', example='activated'),
    unActivateAllDuration?: string(name='UnActivateAllDuration'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  message?: string(name='Message', example='successful'),
  requestId?: string(name='RequestId', description='Id of the request', example='65308A66-8764-53EE-8D4A-201E86CA88C5'),
  success?: string(name='Success', example='true'),
}

model ActivateLicenseResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ActivateLicenseResponseBody(name='body'),
}

/**
 * @summary 激活License
 *
 * @param request ActivateLicenseRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ActivateLicenseResponse
 */
async function activateLicenseWithOptions(request: ActivateLicenseRequest, runtime: $RuntimeOptions): ActivateLicenseResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.fingerprint)) {
    body['Fingerprint'] = request.fingerprint;
  }
  if (!$isNull(request.id)) {
    body['Id'] = request.id;
  }
  if (!$isNull(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.orderId)) {
    body['OrderId'] = request.orderId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'ActivateLicense',
    version = '2020-09-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 激活License
 *
 * @param request ActivateLicenseRequest
 * @return ActivateLicenseResponse
 */
async function activateLicense(request: ActivateLicenseRequest): ActivateLicenseResponse {
  var runtime = new $RuntimeOptions{};
  return activateLicenseWithOptions(request, runtime);
}

model AicsOpenApiInvokeRequest {
  nodeId?: string(name='NodeId', example='119397'),
  param?: map[string]any(name='Param', example='{"a":1}'),
  serviceId?: string(name='ServiceId', description='This parameter is required.', example='ae5f9884c9914ed7af72b07e6c1616f9'),
  type?: string(name='Type', example='EXPERIMENT'),
}

model AicsOpenApiInvokeShrinkRequest {
  nodeId?: string(name='NodeId', example='119397'),
  paramShrink?: string(name='Param', example='{"a":1}'),
  serviceId?: string(name='ServiceId', description='This parameter is required.', example='ae5f9884c9914ed7af72b07e6c1616f9'),
  type?: string(name='Type', example='EXPERIMENT'),
}

model AicsOpenApiInvokeResponseBody = {
  code?: string(name='Code', example='200'),
  data?: any(name='Data', example='{"c":2}'),
  message?: string(name='Message', example='successful'),
  requestId?: string(name='RequestId', description='Id of the request', example='68738E75-43C1-5AE5-9F3A-AFEF576D7B5F'),
  success?: string(name='Success', example='True'),
}

model AicsOpenApiInvokeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AicsOpenApiInvokeResponseBody(name='body'),
}

/**
 * @summary 调用aics openapi
 *
 * @param tmpReq AicsOpenApiInvokeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AicsOpenApiInvokeResponse
 */
async function aicsOpenApiInvokeWithOptions(tmpReq: AicsOpenApiInvokeRequest, runtime: $RuntimeOptions): AicsOpenApiInvokeResponse {
  tmpReq.validate();
  var request = new AicsOpenApiInvokeShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.param)) {
    request.paramShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.param, 'Param', 'json');
  }
  var query = {};
  if (!$isNull(request.nodeId)) {
    query['NodeId'] = request.nodeId;
  }
  if (!$isNull(request.serviceId)) {
    query['ServiceId'] = request.serviceId;
  }
  if (!$isNull(request.type)) {
    query['Type'] = request.type;
  }
  var body : map[string]any = {};
  if (!$isNull(request.paramShrink)) {
    body['Param'] = request.paramShrink;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'AicsOpenApiInvoke',
    version = '2020-09-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 调用aics openapi
 *
 * @param request AicsOpenApiInvokeRequest
 * @return AicsOpenApiInvokeResponse
 */
async function aicsOpenApiInvoke(request: AicsOpenApiInvokeRequest): AicsOpenApiInvokeResponse {
  var runtime = new $RuntimeOptions{};
  return aicsOpenApiInvokeWithOptions(request, runtime);
}

model CreateEssOptJobRequest {
  duration?: int32(name='Duration', example='1'),
  elecPrice?: [ 
    {
      dataTime?: string(name='DataTime', example='00:00:15'),
      price?: string(name='Price', example='0.5'),
    }
  ](name='ElecPrice'),
  freq?: string(name='Freq', example='FIFTEEN_MIN'),
  genPrice?: [ 
    {
      dataTime?: string(name='DataTime', example='00:00:15'),
      price?: string(name='Price', example='0.3'),
    }
  ](name='GenPrice'),
  location?: {
    altitude?: double(name='Altitude', example='10.123'),
    latitude?: double(name='Latitude', example='40.027'),
    longitude?: double(name='Longitude', example='120.042'),
  }(name='Location'),
  modelVersion?: string(name='ModelVersion', example='latest'),
  runDate?: string(name='RunDate', example='2025-02-12'),
  systemData?: [ 
    {
      historyData?: [  map[string]any ](name='HistoryData'),
      systemId?: string(name='SystemId', example='1'),
      systemParams?: map[string]any(name='SystemParams'),
      systemType?: string(name='SystemType', example='ess'),
    }
  ](name='SystemData'),
  timeZone?: string(name='TimeZone', example='Asia/Shanghai'),
  topoType?: string(name='TopoType', example='LOAD_ESS_SOLAR'),
}

model CreateEssOptJobShrinkRequest {
  duration?: int32(name='Duration', example='1'),
  elecPriceShrink?: string(name='ElecPrice'),
  freq?: string(name='Freq', example='FIFTEEN_MIN'),
  genPriceShrink?: string(name='GenPrice'),
  locationShrink?: string(name='Location'),
  modelVersion?: string(name='ModelVersion', example='latest'),
  runDate?: string(name='RunDate', example='2025-02-12'),
  systemDataShrink?: string(name='SystemData'),
  timeZone?: string(name='TimeZone', example='Asia/Shanghai'),
  topoType?: string(name='TopoType', example='LOAD_ESS_SOLAR'),
}

model CreateEssOptJobResponseBody = {
  code?: string(name='Code', example='200'),
  data?: {
    completed?: boolean(name='Completed', example='True'),
    createTime?: string(name='CreateTime', example='2024-12-22 00:00:21'),
    error?: string(name='Error', example='""'),
    jobId?: string(name='JobId', example='8c0ca18a-246a-4acd-80ca-e16d8ff5ef33'),
    progress?: int32(name='Progress', example='25'),
    response?: {
      debugInfo?: any(name='DebugInfo', example='{}'),
      jobType?: string(name='JobType', example='LoadForecast'),
      result?: any(name='Result', example='{}'),
    }(name='Response'),
    status?: string(name='Status', example='RUNNING'),
  }(name='Data'),
  message?: string(name='Message', example='successful'),
  requestId?: string(name='RequestId', description='Id of the request', example='68738E75-43C1-5AE5-9F3A-AFEF576D7B5F'),
  success?: string(name='Success', example='True'),
}

model CreateEssOptJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateEssOptJobResponseBody(name='body'),
}

/**
 * @summary 创建储能运行优化任务
 *
 * @param tmpReq CreateEssOptJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateEssOptJobResponse
 */
async function createEssOptJobWithOptions(tmpReq: CreateEssOptJobRequest, runtime: $RuntimeOptions): CreateEssOptJobResponse {
  tmpReq.validate();
  var request = new CreateEssOptJobShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.elecPrice)) {
    request.elecPriceShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.elecPrice, 'ElecPrice', 'json');
  }
  if (!$isNull(tmpReq.genPrice)) {
    request.genPriceShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.genPrice, 'GenPrice', 'json');
  }
  if (!$isNull(tmpReq.location)) {
    request.locationShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.location, 'Location', 'json');
  }
  if (!$isNull(tmpReq.systemData)) {
    request.systemDataShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.systemData, 'SystemData', 'json');
  }
  var body : map[string]any = {};
  if (!$isNull(request.duration)) {
    body['Duration'] = request.duration;
  }
  if (!$isNull(request.elecPriceShrink)) {
    body['ElecPrice'] = request.elecPriceShrink;
  }
  if (!$isNull(request.freq)) {
    body['Freq'] = request.freq;
  }
  if (!$isNull(request.genPriceShrink)) {
    body['GenPrice'] = request.genPriceShrink;
  }
  if (!$isNull(request.locationShrink)) {
    body['Location'] = request.locationShrink;
  }
  if (!$isNull(request.modelVersion)) {
    body['ModelVersion'] = request.modelVersion;
  }
  if (!$isNull(request.runDate)) {
    body['RunDate'] = request.runDate;
  }
  if (!$isNull(request.systemDataShrink)) {
    body['SystemData'] = request.systemDataShrink;
  }
  if (!$isNull(request.timeZone)) {
    body['TimeZone'] = request.timeZone;
  }
  if (!$isNull(request.topoType)) {
    body['TopoType'] = request.topoType;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateEssOptJob',
    version = '2020-09-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 创建储能运行优化任务
 *
 * @param request CreateEssOptJobRequest
 * @return CreateEssOptJobResponse
 */
async function createEssOptJob(request: CreateEssOptJobRequest): CreateEssOptJobResponse {
  var runtime = new $RuntimeOptions{};
  return createEssOptJobWithOptions(request, runtime);
}

model CreateLoadForecastJobRequest {
  deviceType?: string(name='DeviceType', example='electricityMeter'),
  duration?: int32(name='Duration', example='1'),
  freq?: string(name='Freq', example='FIFTEEN_MIN'),
  historyData?: [ 
    {
      runTime?: string(name='RunTime', example='2025-12-12 00:00:00'),
      value?: double(name='Value', example='1.0'),
    }
  ](name='HistoryData'),
  modelVersion?: string(name='ModelVersion', example='latest'),
  runDate?: string(name='RunDate', example='2025-12-12'),
  systemType?: string(name='SystemType', example='load'),
  timeZone?: string(name='TimeZone', example='Asia/Shanghai'),
}

model CreateLoadForecastJobShrinkRequest {
  deviceType?: string(name='DeviceType', example='electricityMeter'),
  duration?: int32(name='Duration', example='1'),
  freq?: string(name='Freq', example='FIFTEEN_MIN'),
  historyDataShrink?: string(name='HistoryData'),
  modelVersion?: string(name='ModelVersion', example='latest'),
  runDate?: string(name='RunDate', example='2025-12-12'),
  systemType?: string(name='SystemType', example='load'),
  timeZone?: string(name='TimeZone', example='Asia/Shanghai'),
}

model CreateLoadForecastJobResponseBody = {
  code?: string(name='Code', example='200'),
  data?: {
    completed?: boolean(name='Completed', example='True'),
    createTime?: string(name='CreateTime', example='2024-12-22 00:00:21'),
    error?: string(name='Error', example='""'),
    jobId?: string(name='JobId', example='8c0ca18a-246a-4acd-80ca-e16d8ff5ef33'),
    progress?: int32(name='Progress', example='25'),
    response?: {
      debugInfo?: any(name='DebugInfo', example='{}'),
      jobType?: string(name='JobType', example='PowerForecast'),
      result?: any(name='Result', example='{}'),
    }(name='Response'),
    status?: string(name='Status', example='RUNNING'),
  }(name='Data'),
  message?: string(name='Message', example='successful'),
  requestId?: string(name='RequestId', description='Id of the request', example='68738E75-43C1-5AE5-9F3A-AFEF576D7B5F'),
  success?: string(name='Success', example='True'),
}

model CreateLoadForecastJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateLoadForecastJobResponseBody(name='body'),
}

/**
 * @summary 创建用电负荷预测任务
 *
 * @param tmpReq CreateLoadForecastJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateLoadForecastJobResponse
 */
async function createLoadForecastJobWithOptions(tmpReq: CreateLoadForecastJobRequest, runtime: $RuntimeOptions): CreateLoadForecastJobResponse {
  tmpReq.validate();
  var request = new CreateLoadForecastJobShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.historyData)) {
    request.historyDataShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.historyData, 'HistoryData', 'json');
  }
  var body : map[string]any = {};
  if (!$isNull(request.deviceType)) {
    body['DeviceType'] = request.deviceType;
  }
  if (!$isNull(request.duration)) {
    body['Duration'] = request.duration;
  }
  if (!$isNull(request.freq)) {
    body['Freq'] = request.freq;
  }
  if (!$isNull(request.historyDataShrink)) {
    body['HistoryData'] = request.historyDataShrink;
  }
  if (!$isNull(request.modelVersion)) {
    body['ModelVersion'] = request.modelVersion;
  }
  if (!$isNull(request.runDate)) {
    body['RunDate'] = request.runDate;
  }
  if (!$isNull(request.systemType)) {
    body['SystemType'] = request.systemType;
  }
  if (!$isNull(request.timeZone)) {
    body['TimeZone'] = request.timeZone;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateLoadForecastJob',
    version = '2020-09-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 创建用电负荷预测任务
 *
 * @param request CreateLoadForecastJobRequest
 * @return CreateLoadForecastJobResponse
 */
async function createLoadForecastJob(request: CreateLoadForecastJobRequest): CreateLoadForecastJobResponse {
  var runtime = new $RuntimeOptions{};
  return createLoadForecastJobWithOptions(request, runtime);
}

model CreatePowerForecastJobRequest {
  deviceType?: string(name='DeviceType', example='electricityMeter'),
  duration?: int32(name='Duration', example='1'),
  freq?: string(name='Freq', example='FIFTEEN_MIN'),
  historyData?: [ 
    {
      runTime?: string(name='RunTime', example='2025-02-12 00:00:00'),
      value?: double(name='Value', example='1.0'),
    }
  ](name='HistoryData'),
  location?: {
    altitude?: double(name='Altitude', example='10.123'),
    latitude?: double(name='Latitude', example='40.027'),
    longitude?: double(name='Longitude', example='120.042'),
  }(name='Location'),
  modelVersion?: string(name='ModelVersion', example='latest'),
  runDate?: string(name='RunDate', example='2025-02-12'),
  systemType?: string(name='SystemType', example='load'),
  timeZone?: string(name='TimeZone', example='Asia/Shanghai'),
}

model CreatePowerForecastJobShrinkRequest {
  deviceType?: string(name='DeviceType', example='electricityMeter'),
  duration?: int32(name='Duration', example='1'),
  freq?: string(name='Freq', example='FIFTEEN_MIN'),
  historyDataShrink?: string(name='HistoryData'),
  locationShrink?: string(name='Location'),
  modelVersion?: string(name='ModelVersion', example='latest'),
  runDate?: string(name='RunDate', example='2025-02-12'),
  systemType?: string(name='SystemType', example='load'),
  timeZone?: string(name='TimeZone', example='Asia/Shanghai'),
}

model CreatePowerForecastJobResponseBody = {
  code?: string(name='Code', example='200'),
  data?: {
    completed?: boolean(name='Completed', example='True'),
    createTime?: string(name='CreateTime', example='2024-12-22 00:00:21'),
    error?: string(name='Error', example='""'),
    jobId?: string(name='JobId', example='8c0ca18a-246a-4acd-80ca-e16d8ff5ef33'),
    progress?: int32(name='Progress', example='25'),
    response?: {
      debugInfo?: any(name='DebugInfo', example='{}'),
      jobType?: string(name='JobType', example='LoadForecast'),
      result?: any(name='Result', example='{}'),
    }(name='Response'),
    status?: string(name='Status', example='RUNNING'),
  }(name='Data'),
  message?: string(name='Message', example='successful'),
  requestId?: string(name='RequestId', description='Id of the request', example='68738E75-43C1-5AE5-9F3A-AFEF576D7B5F'),
  success?: string(name='Success', example='True'),
}

model CreatePowerForecastJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreatePowerForecastJobResponseBody(name='body'),
}

/**
 * @summary 创建发电功率预测任务
 *
 * @param tmpReq CreatePowerForecastJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreatePowerForecastJobResponse
 */
async function createPowerForecastJobWithOptions(tmpReq: CreatePowerForecastJobRequest, runtime: $RuntimeOptions): CreatePowerForecastJobResponse {
  tmpReq.validate();
  var request = new CreatePowerForecastJobShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.historyData)) {
    request.historyDataShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.historyData, 'HistoryData', 'json');
  }
  if (!$isNull(tmpReq.location)) {
    request.locationShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.location, 'Location', 'json');
  }
  var body : map[string]any = {};
  if (!$isNull(request.deviceType)) {
    body['DeviceType'] = request.deviceType;
  }
  if (!$isNull(request.duration)) {
    body['Duration'] = request.duration;
  }
  if (!$isNull(request.freq)) {
    body['Freq'] = request.freq;
  }
  if (!$isNull(request.historyDataShrink)) {
    body['HistoryData'] = request.historyDataShrink;
  }
  if (!$isNull(request.locationShrink)) {
    body['Location'] = request.locationShrink;
  }
  if (!$isNull(request.modelVersion)) {
    body['ModelVersion'] = request.modelVersion;
  }
  if (!$isNull(request.runDate)) {
    body['RunDate'] = request.runDate;
  }
  if (!$isNull(request.systemType)) {
    body['SystemType'] = request.systemType;
  }
  if (!$isNull(request.timeZone)) {
    body['TimeZone'] = request.timeZone;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreatePowerForecastJob',
    version = '2020-09-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 创建发电功率预测任务
 *
 * @param request CreatePowerForecastJobRequest
 * @return CreatePowerForecastJobResponse
 */
async function createPowerForecastJob(request: CreatePowerForecastJobRequest): CreatePowerForecastJobResponse {
  var runtime = new $RuntimeOptions{};
  return createPowerForecastJobWithOptions(request, runtime);
}

model GetAivppAlgoJobRequest {
  jobId?: string(name='JobId', example='5854bfa6-f002-43c2-8e1d-e9b2c28f9384'),
}

model GetAivppAlgoJobResponseBody = {
  code?: string(name='Code', example='200'),
  data?: {
    completed?: boolean(name='Completed', example='False'),
    createTime?: string(name='CreateTime', example='2024-12-10 17:50:48'),
    error?: string(name='Error', example='""'),
    jobId?: string(name='JobId', example='5854bfa6-f002-43c2-8e1d-e9b2c28f9384'),
    progress?: int32(name='Progress', example='100'),
    response?: {
      debugInfo?: any(name='DebugInfo', example='{}'),
      jobType?: string(name='JobType', example='PowerForecast'),
      result?: any(name='Result', example='{}'),
    }(name='Response'),
    status?: string(name='Status', example='RUNNING'),
  }(name='Data'),
  message?: string(name='Message', example='successful'),
  requestId?: string(name='RequestId', description='Id of the request', example='68738E75-43C1-5AE5-9F3A-AFEF576D7B5F'),
  success?: string(name='Success', example='True'),
}

model GetAivppAlgoJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAivppAlgoJobResponseBody(name='body'),
}

/**
 * @summary 查询aivpp算法job
 *
 * @param request GetAivppAlgoJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAivppAlgoJobResponse
 */
async function getAivppAlgoJobWithOptions(request: GetAivppAlgoJobRequest, runtime: $RuntimeOptions): GetAivppAlgoJobResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.jobId)) {
    body['JobId'] = request.jobId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetAivppAlgoJob',
    version = '2020-09-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 查询aivpp算法job
 *
 * @param request GetAivppAlgoJobRequest
 * @return GetAivppAlgoJobResponse
 */
async function getAivppAlgoJob(request: GetAivppAlgoJobRequest): GetAivppAlgoJobResponse {
  var runtime = new $RuntimeOptions{};
  return getAivppAlgoJobWithOptions(request, runtime);
}

model GetLicenseRequest {
  id?: long(name='Id', description='ID', example='1'),
  instanceId?: string(name='InstanceId', example='c31238fcb74e482588a72de90cd7dba3'),
}

model GetLicenseResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', example='None'),
  code?: string(name='Code', example='200'),
  data?: {
    activateRecord?: [ 
      {
        activateTime?: string(name='ActivateTime', example='2024-04-29 15:03:12'),
        buyTime?: string(name='BuyTime', example='2024-04-29 15:01:15'),
        duration?: string(name='Duration'),
        expireTime?: string(name='ExpireTime', example='2025-05-01 00:00:00'),
        licenseCode?: string(name='LicenseCode', example='XXXX'),
        orderId?: string(name='OrderId', example='1040b91765d14ad1a40ff22589070342'),
        status?: string(name='Status', example='activated'),
      }
    ](name='ActivateRecord'),
    activateTime?: string(name='ActivateTime', description='代表资源一级ID的资源属性字段', example='2024-04-29 15:03:12'),
    adaptiveMachine?: string(name='AdaptiveMachine'),
    allDuration?: string(name='AllDuration'),
    applicableSpecs?: string(name='ApplicableSpecs'),
    buyTime?: string(name='BuyTime', description='代表资源名称的资源属性字段', example='2024-04-29 15:01:15'),
    cpuLimit?: int32(name='CpuLimit', example='72'),
    description?: string(name='Description', example='""'),
    duration?: string(name='Duration'),
    effectTime?: string(name='EffectTime', example='2024-05-01 00:00:00'),
    expireTime?: string(name='ExpireTime', example='2025-05-01 00:00:00'),
    fingerprint?: string(name='Fingerprint', description='代表创建时间的资源属性字段', example='XXX'),
    id?: long(name='Id', description='ID', example='1'),
    instanceId?: string(name='InstanceId', example='c31238fcb74e482588a72de90cd7dba3'),
    licenseCode?: string(name='LicenseCode', example='XXX'),
    licenseSpecCode?: string(name='LicenseSpecCode'),
    licenseSpecName?: string(name='LicenseSpecName', description='代表资源组的资源属性字段'),
    licenseSpecType?: string(name='LicenseSpecType'),
    memoryLimit?: int32(name='MemoryLimit', example='256'),
    proposal?: string(name='Proposal'),
    status?: string(name='Status', example='activated'),
    unActivateAllDuration?: string(name='UnActivateAllDuration'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  message?: string(name='Message', example='successful'),
  requestId?: string(name='RequestId', example='68738E75-43C1-5AE5-9F3A-AFEF576D7B5F'),
  success?: string(name='Success', example='true'),
}

model GetLicenseResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetLicenseResponseBody(name='body'),
}

/**
 * @summary License详情
 *
 * @param request GetLicenseRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetLicenseResponse
 */
async function getLicenseWithOptions(request: GetLicenseRequest, runtime: $RuntimeOptions): GetLicenseResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.id)) {
    body['Id'] = request.id;
  }
  if (!$isNull(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetLicense',
    version = '2020-09-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary License详情
 *
 * @param request GetLicenseRequest
 * @return GetLicenseResponse
 */
async function getLicense(request: GetLicenseRequest): GetLicenseResponse {
  var runtime = new $RuntimeOptions{};
  return getLicenseWithOptions(request, runtime);
}

model ListAivppResourcesRequest {
  currentPage?: int32(name='CurrentPage', example='1'),
  maxResults?: int32(name='MaxResults', example='20'),
}

model ListAivppResourcesResponseBody = {
  code?: string(name='Code', example='200'),
  data?: [ 
    {
      detail?: string(name='Detail'),
      expireTime?: string(name='ExpireTime', example='2034-03-09T17:47:11Z'),
      instanceId?: string(name='InstanceId', example='i-bp154xh3gt3adb4xu1ue'),
      instanceType?: string(name='InstanceType', example='api'),
      leftQuantity?: string(name='LeftQuantity', example='1'),
      orderId?: string(name='OrderId', example='231287932080007'),
      quantity?: string(name='Quantity', example='1'),
      specification?: string(name='Specification', example='LoadForecasting'),
      startTime?: string(name='StartTime', example='2024-09-08T01:16Z'),
      status?: string(name='Status', example='Normal'),
      userId?: string(name='UserId', example='123456789'),
    }
  ](name='Data'),
  maxResults?: int32(name='MaxResults', example='20'),
  message?: string(name='Message', example='successful'),
  nextToken?: string(name='NextToken', example='37cc36b4344b182d36b45d95ae4ef03952ee5c24733ba461'),
  requestId?: string(name='RequestId', description='Id of the request', example='68738E75-43C1-5AE5-9F3A-AFEF576D7B5F'),
  success?: string(name='Success', example='True'),
  totalCount?: int32(name='TotalCount', example='30'),
}

model ListAivppResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListAivppResourcesResponseBody(name='body'),
}

/**
 * @summary 获取用户AIVPP资源列表
 *
 * @param request ListAivppResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListAivppResourcesResponse
 */
async function listAivppResourcesWithOptions(request: ListAivppResourcesRequest, runtime: $RuntimeOptions): ListAivppResourcesResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.currentPage)) {
    body['CurrentPage'] = request.currentPage;
  }
  if (!$isNull(request.maxResults)) {
    body['MaxResults'] = request.maxResults;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListAivppResources',
    version = '2020-09-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取用户AIVPP资源列表
 *
 * @param request ListAivppResourcesRequest
 * @return ListAivppResourcesResponse
 */
async function listAivppResources(request: ListAivppResourcesRequest): ListAivppResourcesResponse {
  var runtime = new $RuntimeOptions{};
  return listAivppResourcesWithOptions(request, runtime);
}

model ListLicensesRequest {
  currentPage?: int32(name='CurrentPage', example='1'),
  pageSize?: int32(name='PageSize', example='12'),
  queryStr?: string(name='QueryStr'),
}

model ListLicensesResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', example='{}'),
  code?: string(name='Code', example='200'),
  currentPage?: int32(name='CurrentPage', example='1'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  licenseList?: [ 
    {
      activateTime?: string(name='ActivateTime', example='2024-10-14 14:15:45'),
      adaptiveMachine?: int32(name='AdaptiveMachine'),
      allDuration?: string(name='AllDuration'),
      buyTime?: string(name='BuyTime', example='2024-10-14 13:17:20'),
      cpuLimit?: int32(name='CpuLimit', example='72'),
      description?: string(name='Description', example='""'),
      duration?: string(name='Duration'),
      effectTime?: string(name='EffectTime', example='2024-10-14 14:15:45'),
      expireTime?: string(name='ExpireTime', example='2025-10-14 14:15:45'),
      id?: string(name='Id', example='1'),
      instanceId?: string(name='InstanceId', example='451f14ee73604aesdfe4da606764ce09'),
      licenseSpecCode?: string(name='LicenseSpecCode', example='aics_1000'),
      licenseSpecName?: string(name='LicenseSpecName'),
      licenseSpecType?: string(name='LicenseSpecType', example='brainindustrial_aicsruntime_public_cn'),
      memoryLimit?: int32(name='MemoryLimit', example='256'),
      status?: string(name='Status', example='activated'),
      unActivateAllDuration?: string(name='UnActivateAllDuration'),
    }
  ](name='LicenseList'),
  message?: string(name='Message', example='successful'),
  pageSize?: int32(name='PageSize', example='12'),
  requestId?: string(name='RequestId', example='FAC892CE-5A94-5616-91DC-629B09CC6792'),
  success?: boolean(name='Success', example='true'),
  totalCount?: long(name='TotalCount', example='42'),
  totalPage?: string(name='TotalPage', example='4'),
  totalPageCount?: string(name='TotalPageCount', example='4'),
}

model ListLicensesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListLicensesResponseBody(name='body'),
}

/**
 * @summary License列表
 *
 * @param request ListLicensesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListLicensesResponse
 */
async function listLicensesWithOptions(request: ListLicensesRequest, runtime: $RuntimeOptions): ListLicensesResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.currentPage)) {
    body['CurrentPage'] = request.currentPage;
  }
  if (!$isNull(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.queryStr)) {
    body['QueryStr'] = request.queryStr;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListLicenses',
    version = '2020-09-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary License列表
 *
 * @param request ListLicensesRequest
 * @return ListLicensesResponse
 */
async function listLicenses(request: ListLicensesRequest): ListLicensesResponse {
  var runtime = new $RuntimeOptions{};
  return listLicensesWithOptions(request, runtime);
}

model ListUserResourcesRequest {
  commodityCode?: string(name='CommodityCode', example='BrainIndustrial'),
}

model ListUserResourcesResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail'),
  code?: string(name='Code', example='200'),
  data?: [ 
    {
      chargeType?: string(name='chargeType'),
      commodityCode?: string(name='commodityCode', example='brainindustrial_simupostpaid_public_cn'),
      endDate?: string(name='endDate', example='2024-12-21'),
      instanceId?: string(name='instanceId', example='12345ea3cff446e8837078c2baffbe83'),
      region?: string(name='region', example='cn-hangzhou'),
      startDate?: string(name='startDate', example='20240902'),
      status?: string(name='status', example='""'),
      statusMsg?: string(name='statusMsg'),
    }
  ](name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  message?: string(name='Message', example='successful'),
  requestId?: string(name='RequestId', description='Id of the request', example='65308A66-8764-53EE-8D4A-201E86CA88C5'),
  success?: string(name='Success', example='true'),
}

model ListUserResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListUserResourcesResponseBody(name='body'),
}

/**
 * @summary 获取用户资源列表
 *
 * @param request ListUserResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListUserResourcesResponse
 */
async function listUserResourcesWithOptions(request: ListUserResourcesRequest, runtime: $RuntimeOptions): ListUserResourcesResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.commodityCode)) {
    body['CommodityCode'] = request.commodityCode;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListUserResources',
    version = '2020-09-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取用户资源列表
 *
 * @param request ListUserResourcesRequest
 * @return ListUserResourcesResponse
 */
async function listUserResources(request: ListUserResourcesRequest): ListUserResourcesResponse {
  var runtime = new $RuntimeOptions{};
  return listUserResourcesWithOptions(request, runtime);
}

model UpdateLicenseDescriptionRequest {
  description?: string(name='Description'),
  instanceId?: string(name='InstanceId', example='brainindustrial_aicsruntime_public_cn-mdu3ps3kw04'),
}

model UpdateLicenseDescriptionResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail'),
  code?: string(name='Code', example='200'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message', example='successful'),
  requestId?: string(name='RequestId', description='Id of the request', example='68738E75-43C1-5AE5-9F3A-AFEF576D7B5F'),
  success?: string(name='Success', example='True'),
}

model UpdateLicenseDescriptionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateLicenseDescriptionResponseBody(name='body'),
}

/**
 * @summary 更新license描述
 *
 * @param request UpdateLicenseDescriptionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateLicenseDescriptionResponse
 */
async function updateLicenseDescriptionWithOptions(request: UpdateLicenseDescriptionRequest, runtime: $RuntimeOptions): UpdateLicenseDescriptionResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.description)) {
    body['Description'] = request.description;
  }
  if (!$isNull(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdateLicenseDescription',
    version = '2020-09-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 更新license描述
 *
 * @param request UpdateLicenseDescriptionRequest
 * @return UpdateLicenseDescriptionResponse
 */
async function updateLicenseDescription(request: UpdateLicenseDescriptionRequest): UpdateLicenseDescriptionResponse {
  var runtime = new $RuntimeOptions{};
  return updateLicenseDescriptionWithOptions(request, runtime);
}

